package huawei.js2025;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 开放日活动
 */
public class Question18 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int SUM = sc.nextInt(); // 桶内的小球数量不能超过SUM
        int len = sc.nextInt(); // 桶数量

        int[] bucketBallNums = new int[len];

        int sum = 0;
        int maxVal = 0;
        for (int i = 0; i < len; i++) {
            bucketBallNums[i] = sc.nextInt();
            sum += bucketBallNums[i];
            maxVal = Math.max(maxVal, bucketBallNums[i]);
        }

        int minVal = SUM / len;

        int[] takeOutNums = new int[len];


        for (int val = maxVal; val >= minVal; val--) {
            int total = 0;
            for (int i = 0; i < len; i++) {
                total += Math.min(bucketBallNums[i], val);
            }
            if (total <= SUM) {
                for (int i = 0; i < len; i++) {
                    takeOutNums[i] = Math.max(bucketBallNums[i] - val, 0);
                }
                break;
            }
        }


        System.out.println(Arrays.toString(takeOutNums));
    }


}
